<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<head>
<title>Rota Estatisctica - Cadastro de Rota</title>
</head>

<body>

	<h2>Cadastro de Rota</h2>
	<br />

	<h3>Preencha as informações referentes à rota</h3>

	<h:form>


		<rich:messages globalOnly="true" infoStyle="color:blue"
			warnStyle="color:orange" errorStyle="color:red"
			fatalStyle="color:red"></rich:messages>

		<h:panelGrid columns="4">




			<h:outputText value="Linha"></h:outputText>

			<h:panelGroup>
				<h:selectOneMenu id="linha"
					value="#{cadastroTrajetoView.idLinhaSelecionada}"
					valueChangeListener="#{cadastroTrajetoView.selecionouLinha}"
					onchange="submit();" immediate="true">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{cadastroTrajetoView.linhas}"></f:selectItems>
					<a4j:support event="onchange"
						reRender="regionEstacaoOrigem, regionEstacaoDestino"
						immediate="true"></a4j:support>
				</h:selectOneMenu>

			</h:panelGroup>

			<h:outputText value=""></h:outputText>
			<h:outputText value=""></h:outputText>





			<h:outputText value="Origem"></h:outputText>



			<h:panelGroup>
				<a4j:region id="regionEstacaoOrigem">
					<h:selectOneMenu id="estacaoOrigem"
						value="#{cadastroTrajetoView.idEstacaoOrigemSelecionada}">
						<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
						<f:selectItems
							value="#{cadastroTrajetoView.estacoesDaLinhaSelecionada}"></f:selectItems>
					</h:selectOneMenu>
				</a4j:region>

			</h:panelGroup>

			<h:outputText value="Data e horário de partida"></h:outputText>

			<h:panelGroup>
				<a4j:outputPanel layout="block">
					<rich:calendar id="dataEHorarioPartida"
						value="#{cadastroTrajetoView.horarioDePartida}" locale="BR"
						popup="true" datePattern="dd/MM/yyyy HH:mm" showApplyButton="true"
						cellWidth="24px" cellHeight="22px" style="width:200px">
					</rich:calendar>
				</a4j:outputPanel>

			</h:panelGroup>






			<h:outputText value="Destino"></h:outputText>

			<h:panelGroup>
				<a4j:region id="regionEstacaoDestino">
					<h:selectOneMenu id="estacaoDestino"
						value="#{cadastroTrajetoView.idEstacaoDestinoSelecionada}">
						<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
						<f:selectItems
							value="#{cadastroTrajetoView.estacoesDaLinhaSelecionada}"></f:selectItems>
					</h:selectOneMenu>
				</a4j:region>

			</h:panelGroup>


			<h:outputText value="Data e horário de chegada"></h:outputText>

			<h:panelGroup>
				<a4j:outputPanel>
					<rich:calendar id="dataEHorarioChegada"
						value="#{cadastroTrajetoView.horarioDeChegada}" locale="BR"
						popup="true" datePattern="dd/MM/yyyy HH:mm" showApplyButton="true"
						cellWidth="24px" cellHeight="22px" style="width:200px">
					</rich:calendar>
				</a4j:outputPanel>

			</h:panelGroup>






			<h:outputText value="Lotação"></h:outputText>

			<h:panelGroup>
				<h:selectOneMenu id="lotacao"
					value="#{cadastroTrajetoView.idLotacaoSelecionada}">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{cadastroTrajetoView.lotacoes}"></f:selectItems>
				</h:selectOneMenu>
				<rich:message for="lotacao" style="color:red" />
			</h:panelGroup>







			<h:outputText value="Clima"></h:outputText>

			<h:panelGroup>
				<h:selectOneMenu id="clima"
					value="#{cadastroTrajetoView.idClimaSelecionado}">
					<f:selectItem itemLabel="Selecione" itemValue=""></f:selectItem>
					<f:selectItems value="#{cadastroTrajetoView.climas}"></f:selectItems>
				</h:selectOneMenu>
				<rich:message for="clima" style="color:red" />
			</h:panelGroup>

		</h:panelGrid>

		<h:panelGrid columns="2">
			<h:commandButton value="Salvar"
				action="#{cadastroTrajetoView.salvarTrajeto}"></h:commandButton>
				<h:commandButton value="Home" action="HOME"></h:commandButton>
		</h:panelGrid>


	</h:form>

</body>
</html>